//
//  DailyRecordCell.m
//  DefendHealth
//
//  Created by 吾诺瀚卓 on 17/3/8.
//  Copyright © 2017年 iMacOne. All rights reserved.
//

#import "DailyRecordCell.h"

@implementation DailyRecordCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        [self initCellUI];
        
    }
    
    return self;
    
}


- (void)initCellUI {
    self.contentView.backgroundColor = kWhiteColor;
    
    UILabel *dayRecordL = [ReduceCode creatLabelWithFrame:CGRectMake(20, 10, 100, 20) title:@"每日记录" titleColor:UIColorFromRGB(0x333333) font:14 textAlignment:NSTextAlignmentLeft];
    [self.contentView addSubview:dayRecordL];
    
    
    
    [ToolUtil createLine:35 superView:self.contentView lift:10 width:kScreenWidth-20 hight:2 color:UIColorFromRGB(0xf7f7f8)];
    
    UIView *graphView = [[UIView alloc]initWithFrame:CGRectMake(0, 37, kScreenWidth, 180)];
    graphView.backgroundColor = kWhiteColor;
    [self.contentView addSubview:graphView];
    
    UILabel *minutesL = [ReduceCode creatLabelWithFrame:CGRectMake(kMaxX(graphView.frame)-200, 10, 180, 20) title:@"日平均：30分钟" titleColor:UIColorFromRGB(0x888888) font:12 textAlignment:NSTextAlignmentRight];
    [self.contentView addSubview:minutesL];
    
    [ToolUtil createLine:kMaxY(graphView.frame)+1 superView:self.contentView lift:10 width:kScreenWidth-20 hight:2 color:UIColorFromRGB(0xf7f7f8)];
    
    
    CGFloat w = (kScreenWidth-100)/2;
    UILabel *dayL = [ReduceCode creatLabelWithFrame:CGRectMake(w, kMaxY(graphView.frame)+10, 100, 20) title:@"02/20-02/26" titleColor:UIColorFromRGB(0x333333) font:14 textAlignment:NSTextAlignmentCenter];
    [self.contentView addSubview:dayL];
    
    UIButton *leftBut = [UIButton creatBtnWithFrame:CGRectMake(w-30, kMaxY(graphView.frame)+5, 30, 30) btnTitle:nil btnTitleColor:nil btnTitleFont:0 btnTagPrice:0 btnSetImage:IMAGE(@"icon_left") btnBackgroundColor:nil isCorner:NO action:^(UIButton *button) {
        NSLog(@">>>left");
    }];
    [self.contentView addSubview:leftBut];
    
    UIButton *rightBut = [UIButton creatBtnWithFrame:CGRectMake(w+100, kMaxY(graphView.frame)+5, 30, 30) btnTitle:nil btnTitleColor:nil btnTitleFont:0 btnTagPrice:0 btnSetImage:IMAGE(@"right-1") btnBackgroundColor:nil isCorner:NO action:^(UIButton *button) {
        NSLog(@">>>rightBut");
    }];
    [self.contentView addSubview:rightBut];
    
}


+(NSString *)cellReuseID:(NSInteger)section {
    
    if (section == 0) {
        return @"DailyRecordCell";
    }
    else{
        return @"RecordDetailsCell";
    }
    
}
+(CGFloat)cellForHeight:(NSInteger)section {
    
    if (section == 0) {
        return 255;
    }
    else{
        return 55;
    }
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
